﻿using System;

namespace TLang.Parsers
{
    using Ast;

    public class ParserException : Exception
    {
        public int line;
        public int col;
        public int start;


        public ParserException(String message, int line, int col, int start) : base(message)
        {
            this.line = line;
            this.col = col;
            this.start = start;
        }


        public ParserException(String message, Node node) : base(message)
        {
            this.line = node.line;
            this.col = node.col;
            this.start = node.start;
        }

        public override String ToString()
        {
            return (line + 1) + ":" + (col + 1) + " parsing error " + Message;
        }
    }
}
